#include <iostream>

using namespace std;

int main() {
    int i = 0, j = 0;
    for (i = 1; i < 10; i++) {
        for (j = 1; j <= i; j++) {
            cout << i << "*" << j << "=";
            cout.width(4);		        						//设置结果宽度为4
            cout.setf(ios::left, ios::adjustfield);				//设置对齐为左对齐方式
            cout << i*j << " ";
        }
        cout << endl;
    }

    //第二种方式
    int a, b;
    for (b = 1; b <= 9; b++) {
        for (a = 1; a <= b; a++) {
            cout << a << "*" << b<< "="<< setw(2) << a*b << " ";
        }
        cout << endl;
    }

    return 0;

}